Telegram Group & Telegram Channel
🎓 Задача по Python #50

Описание:

Создайте класс Soda (для определения типа газированной воды), принимающий 1 аргумент при инициализации (отвечающий за добавку к выбираемому лимонаду).
В этом классе реализуйте метод show_my_drink(), выводящий на печать «Газировка и {ДОБАВКА}» в случае наличия добавки, а иначе отобразится следующая фраза: «Обычная газировка».

При решении задания можно дополнительно проверить тип передаваемого аргумента: принимается только строка.

Решение:

class Soda:
def __init__(self, ingredient=None):
if isinstance(ingredient, str):
self.ingredient = ingredient
else:
self.ingredient = None

def show_my_drink(self):
if self.ingredient:
print(f'Газировка и {self.ingredient}')
else:
print('Обычная газировка')


Свой вариант решения в комментарии 💬

#задачи



tg-me.com/pythonturboru/566
Create:
Last Update:

🎓 Задача по Python #50

Описание:

Создайте класс Soda (для определения типа газированной воды), принимающий 1 аргумент при инициализации (отвечающий за добавку к выбираемому лимонаду).
В этом классе реализуйте метод show_my_drink(), выводящий на печать «Газировка и {ДОБАВКА}» в случае наличия добавки, а иначе отобразится следующая фраза: «Обычная газировка».

При решении задания можно дополнительно проверить тип передаваемого аргумента: принимается только строка.

Решение:

class Soda:
def __init__(self, ingredient=None):
if isinstance(ingredient, str):
self.ingredient = ingredient
else:
self.ingredient = None

def show_my_drink(self):
if self.ingredient:
print(f'Газировка и {self.ingredient}')
else:
print('Обычная газировка')


Свой вариант решения в комментарии 💬

#задачи

BY Python Turbo. Уютное сообщество Python разработчиков.




Share with your friend now:
tg-me.com/pythonturboru/566

View MORE
Open in Telegram


Python Turbo Уютное сообщество Python разработчиков Telegram | DID YOU KNOW?

Date: |

Telegram and Signal Havens for Right-Wing Extremists

Since the violent storming of Capitol Hill and subsequent ban of former U.S. President Donald Trump from Facebook and Twitter, the removal of Parler from Amazon’s servers, and the de-platforming of incendiary right-wing content, messaging services Telegram and Signal have seen a deluge of new users. In January alone, Telegram reported 90 million new accounts. Its founder, Pavel Durov, described this as “the largest digital migration in human history.” Signal reportedly doubled its user base to 40 million people and became the most downloaded app in 70 countries. The two services rely on encryption to protect the privacy of user communication, which has made them popular with protesters seeking to conceal their identities against repressive governments in places like Belarus, Hong Kong, and Iran. But the same encryption technology has also made them a favored communication tool for criminals and terrorist groups, including al Qaeda and the Islamic State.

NEWS: Telegram supports Facetime video calls NOW!

Secure video calling is in high demand. As an alternative to Zoom, many people are using end-to-end encrypted apps such as WhatsApp, FaceTime or Signal to speak to friends and family face-to-face since coronavirus lockdowns started to take place across the world. There’s another option—secure communications app Telegram just added video calling to its feature set, available on both iOS and Android. The new feature is also super secure—like Signal and WhatsApp and unlike Zoom (yet), video calls will be end-to-end encrypted.

Python Turbo Уютное сообщество Python разработчиков from cn


Telegram Python Turbo. Уютное сообщество Python разработчиков.
FROM USA